home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3796 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.7 KB  |  63 lines

  1. Path: wisdom.connectsoft.net!usenet
  2. From: mrc@maverick.corus.co.in (Milind R. Changire)
  3. Newsgroups: comp.lang.c++
  4. Subject: template: Problem using MFC templates (MSVC 4.0)
  5. Date: Mon, 22 Jan 1996 09:12:01 GMT
  6. Message-ID: <4dvk6c$utk@wisdom.connectsoft.net>
  7. NNTP-Posting-Host: 204.94.124.59
  8. Keywords: template
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11.  
  12. I am using the CList template class.
  13. What I want to do is this:
  14. I want to provide a simple interface to Add, Delete, Find etc. for a
  15. list.
  16. So, I have written my own template MyList and provided the functions
  17. Add(), Delete(), Find() etc.
  18. The class template is defined as 
  19.  
  20. template <class T>
  21. class MyList {
  22. //...
  23.  
  24. protected :
  25.     CList<T, T>    m_List;
  26.  
  27. };
  28.  
  29. Now I have a data member as
  30.     CList<T, T>    m_List 
  31. in my template class.
  32.     where T is pointer to some class, and CList is a MFC template class.
  33.  
  34. I use the m_List object to hold the data info.
  35. I want to have a template object inside my own template class.
  36. Is this possible ?
  37.  
  38. Also, I get linker errors like
  39.  
  40. error LNK2001: unresolved external symbol "public: __thiscall
  41. MyList<class CTP *>::~MyList<class CTP
  42. *>(void)"(??1?$MyList@PAVCTP@@@@QAE@XZ)
  43.  
  44. error LNK2001: unresolved external symbol "public: __thiscall
  45. MyList<class CTP *>::~MyList<class CTP
  46. *>(void)"(??1?$MyList@PAVCTP@@@@QAE@XZ)
  47.  
  48. error LNK2001: unresolved external symbol "public: __thiscall
  49. MyList<class CTP *>::MyList<class CTP
  50. *>(void)"(??0?$MyList@PAVCTP@@@@QAE@XZ)
  51.  
  52. error LNK2001: unresolved external symbol "public: class CTP *
  53. __thiscall MyList<class CTP *>::Add(class CTP *
  54. &)"(?Add@?$MyList@PAVCTP@@@@QAEQAVCTP@@AAPAV2@@Z)
  55.  
  56.  
  57. whereas I have defined all the functions in my template class .CPP
  58. file. I haven't missed out on a single function.
  59.  
  60.     -Milind Changire
  61.  
  62.  
  63.